<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>概念众包运营平台</title>
    <link rel="stylesheet" href="./public/bower_components/bootstrap/dist/css/bootstrap.min.css">
    <script src="./public/dist/js/jquery.min.js"></script>
    <script src="./public/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="./public/dist/css/index.css">
    <link rel="stylesheet" href="./public/dist/css/spop.min.css">
    <script src="./public/dist/js/spop.min.js"></script>
    <link rel="stylesheet" href="./public/dist/css/loading.css">
    <script src="./public/dist/js/loading.js"></script>
    <link rel="stylesheet" href="./public/dist/css/AdminLTE.min.css">
    <link rel="stylesheet" href="./public/bower_components/font-awesome/css/font-awesome.min.css">
    <style type="text/css">
        table{
            table-layout: fixed;
        }
        td{
            width: 100%;
            word-break: keep-all;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        tr{
            cursor: pointer;
        }
        .chen-content {
            min-height: 100%;
            background-color: #ecf0f5;
            z-index: 800;
            height: auto;
        }
    </style>
</head>
<body>
<div class="chen-content">
    <section class="content-header">
        <h1>
            用户信息
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 用户</a></li>
            <li class="active">用户信息</li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-3">
                <div class="box box-primary">
                    <div class="box-body box-profile">
                        <img class="profile-user-img img-responsive img-circle" src="./public/dist/img/user2-160x160.jpg" alt="User profile picture">
                        <h3 class="profile-username text-center"><span style="font-family: 楷体;"><?php echo $user['name']; ?></span></h3>
                        <p style="height: 10px;"></p>
                        <ul class="list-group list-group-unbordered">
                            <li class="list-group-item">
                                <b>账户</b> <a class="pull-right"><?php echo $user['account']; ?></a>
                            </li>
                            <li class="list-group-item">
                                <b>昵称</b> <a class="pull-right"><?php echo $user['name']; ?></a>
                            </li>
                            <li class="list-group-item">
                                <b>联系方式</b> <a class="pull-right"><?php echo $user['phone']; ?></a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="col-md-9">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#timeline" data-toggle="tab">登录记录</a></li>
                        <li><a href="#settings" data-toggle="tab">修改信息</a></li>
                    </ul>
                    <div class="tab-content">
                        <div class="active tab-pane" id="timeline">
                            <ul class="timeline timeline-inverse">
                                <li class="time-label">
                                     <span class="bg-red">time-line</span>
                                </li>
                                <?php foreach ($log as $key => $value): ?>
                                <li>
                                    <i class="fa fa-envelope bg-blue"></i>
                                    <div class="timeline-item">
                                        <span class="time"><i class="fa fa-clock-o"></i><?php echo date('H:i', $value['login_time']); ?></span>
                                        <h3 class="timeline-header"><a href="#"><?php echo $user['name']; ?></a></h3>
                                        <div class="timeline-body">
                                          登录时间为：<?php echo date('Y-m-d H:i:s', $value['login_time']); ?>
                                        </div>
                                    </div>
                                </li>
                                <?php endforeach; ?>
                            </ul>
                        </div>
                        <div class="tab-pane" id="settings">
                            <div class="form-horizontal">
                                <div class="form-group">
                                    <label for="saveName" class="col-sm-2 control-label">昵称</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" id="saveName" placeholder="请输入昵称" value="<?php echo $user['name']; ?>">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="savePhone" class="col-sm-2 control-label">联系方式</label>
                                    <div class="col-sm-8">
                                        <input class="form-control" id="savePhone" placeholder="请输入联系方式" value="<?php echo $user['phone']; ?>">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10">
                                        <button class="btn btn-info" id="apply">提交</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
</body>
<script type="application/javascript">
    $(document).ready(function () {
       $('#apply').click(function () {
           var saveName = $('#saveName').val();
           var savePhone = $('#savePhone').val();
           if (saveName.length < 1 || savePhone.length < 1) {
               show('信息不能为空', 'warning');
               return false;
           }
           loading('正在提交中...');
           $.ajax({
               type:"post",
               url:"./index.php?s=Home/Index/saveInfo",
               async:true,
               datatype:'json',
               data:{
                   name:saveName,
                   phone:savePhone
               },
               timeout:1000,
               cache:false,
               success:function (data) {
                   removeLoading('loading');
                   if(data.code == 0){
                       show('修改成功', 'success');
                   }else{
                       show('修改失败', 'error');
                   }
               }
           });
       });
    })
</script>
</html>